package com.woniu.postbar.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniu.postbar.entity.dto.PostCollectDTO;
import com.woniu.postbar.entity.vo.PostCollectVO;
import com.woniu.postbar.pojo.PostCollect;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wu
 * @since 2023-05-20
 */
public interface PostCollectMapper extends BaseMapper<PostCollect> {

    @Insert("insert into t_post_collect(user_id, user_post_id, create_time) values (#{collect.userId},#{collect.userPostId},#{collect.createTime})")
    Boolean increaseCollect(@Param("collect") PostCollect collect);

    @Delete("delete from t_post_collect where id = #{id}")
    Boolean deleteCollect(@Param("id") Integer id);

    IPage<PostCollectVO> search(IPage page, @Param("collectDTO") PostCollectDTO collectDTO);
}
